<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
$ui = new UI();
$tpl = new Template2();
if ( isset( $_POST['pass'] ) && getvar( "pass" ) != "" )
{
    if ( !check_account_legal( getvar( "pass" ) ) )
    {
        diemsg( "密码必须为６个以上的英文字母及数字混和所组成！（请注意英文大小写）" );
    }
    $fields = array();
    $fields['pass'] = "'".md5( getvar( "pass" ) )."'";
    db_update( "k_user", $fields, "id=".$curruser['id'] );
    $tpl->set( "alertmsg", "更改密码成功！" );
}
$tpl->load( array("menu" => "6h_menu.htm", "main" => "info.htm", "news" => "news.htm" ) );
$tpl->show( "menu" );
$conf = new Config();
 $news = $conf->Get( "news" );
$tpl->set( "newsmessage", $news );
$backTDList = "";
$disk1Flag = false;
$disk2Flag = false;
$disk3Flag = false;
$disk4Flag = false;
$listNullTd = "";
$colspanI = 3;
$diskArr = array();
if ( $curruser['disk1'] == 1 )
{
    array_push( $diskArr, "A" );
    $backTDList .= "<td nowrap>A 盘退水</td>";
    $disk1Flag = true;
    $listNullTd .= "<td nowrap align=\"left\"> - </td>";
    ++$colspanI;
}
if ( $curruser['disk2'] == 1 )
{
    array_push( $diskArr, "B" );
    $backTDList .= "<td nowrap>B 盘退水</td>";
    $disk2Flag = true;
    $listNullTd .= "<td nowrap align=\"left\"> - </td>";
    ++$colspanI;
}
if ( $curruser['disk3'] == 1 )
{
    array_push( $diskArr, "C" );
    $backTDList .= "<td nowrap>C 盘退水</td>";
    $disk3Flag = true;
    $listNullTd .= "<td nowrap align=\"left\"> - </td>";
    ++$colspanI;
}
if ( $curruser['disk4'] == 1 )
{
    array_push( $diskArr, "D" );
    $backTDList .= "<td nowrap>D 盘退水</td>";
    $disk4Flag = true;
    $listNullTd .= "<td nowrap align=\"left\"> - </td>";
    ++$colspanI;
}
if ( 0 < count( $diskArr ) )
{
    $currDisk = implode( " + ", $diskArr )." 盘";
}
else
{
    $currDisk = "--";
}
$tpl->set( array( "account" => $curruser['account'], "name" => $curruser['name'], "amount" => number_format( $curruser['amount'] ), "disk" => $currDisk, "backTDList" => $backTDList ) );
$list = "";
$rs1 = getdb( "select * from amounts where user_id=".$curruser['id']." order by bettype" );
$data=array();
$order=array(0=>0,1=>1,2=>2,3=>3,4=>6,47=>4,49=>4,50=>4,28=>5,15=>6,16=>6,16=>6,17=>6,23=>6,25=>6,5=>7,6=>8,11=>9,10=>10,7=>11,8=>12,9=>13,48=>14,
	12=>15,13=>16,14=>17,18=>18,19=>19,20=>20,22=>21,21=>22,27=>23,30=>24,
	36=>25,29=>26,39=>27,40=>28,41=>28,42=>28,43=>28,44=>28,45=>28);
while (!$rs1->eof)
{
	$item=$rs1->f;
	$item['order']=(isset($order[$rs1->f['bettype']])?$order[$rs1->f['bettype']]:99);
	$data[]=$item;
	$rs1->movenext();
}
$data=SortArray($data,"order");
foreach($data as $rs1)
{
    $list .= "<tr >";
    $list .= "<td nowrap >".$g_betname[$rs1['bettype']].( $rs1['bettype'] == 27 || $rs1['bettype'] == 36 ? $rs1['subid'] : "" );
    if ( $rs1['amount2'] == 0 )
    {
        $list .= "<td nowrap align=left> -";
        $list .= "<td nowrap align=left> -";
        $list .= $listNullTd;
    }
    else
    {
        if ( $disk1Flag )
        {
            $list .= "<td nowrap align=\"left\">".round( 100 - $rs1['back1'], 2 )."</td>";
        }
        if ( $disk2Flag )
        {
            $list .= "<td nowrap align=\"left\">".round( 100 - $rs1['back2'], 2 )."</td>";
        }
        if ( $disk3Flag )
        {
            $list .= "<td nowrap align=\"left\">".round( 100 - $rs1['back3'], 2 )."</td>";
        }
        if ( $disk4Flag )
        {
            $list .= "<td nowrap align=\"left\">".round( 100 - $rs1['back4'], 2 )."</td>";
        }
        if ( $rs1['bettype'] == 24 || $rs1['bettype'] == 26 || 31 <= $rs1['bettype'] && $rs1['bettype'] <= 33 )
        {
            $list .= "<td nowrap align=left><font color=red> *</font>";
            $list .= "<td nowrap align=left><font color=red> *</font>";
        }
        else
        {
            $list .= "<td nowrap align=left>".number_format( $rs1['amount1'] );
            $list .= "<td nowrap align=left>".number_format( $rs1['amount2'] );
        }
    }
}
if ( $list == "" )
{
    $list = "<tr class=\"row1\"><td colspan=\"".$colspanI."\">查无".$tblName."资料</td></tr>";
}
$tpl->set( "amountlist", $list );
$tpl->show( "news" );
$tpl->show( "main" );
$ui->footer();
?>